﻿@using System.Web.Configuration
@using BMap
<!DOCTLongitudePE html>
<html>
<head>
    <meta name="viewport" content="width=device-width"/>
    <meta charset="UTF-8"/>
    <title>百度地图：MVC实例</title>
    <style type="text/css">
        #container {width: 100%;max-width: 960px;font-family: "Microsoft LongitudeaHei", Arial;margin: 20px auto 0 auto;}
        hr { margin: 20px 0; }
    </style>
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script>
        function alertMe(marker) {
            alert(marker.K);
        }
    </script>
</head>
<body>
    <div id="container">
        <h2>百度地图Mvc实例</h2>
        <hr/>
        <div id="map1" style="width: 100%; height: 500px;"></div>
        @using (Html.BeginBaiduMap("map1", 116.404, 39.915, 11))
        {
            @Html.RenderLabel("欢迎使用百度地图，这是一个简单的文本标注哦~", 116.404, 39.915, style: new { color = "red", fontFamily = "微软雅黑" })
            @Html.RenderMarker(116.404, 39.915, draggable:true)
            @Html.RenderMarker(116.44, 39.90, onClientClick: "alertMe")
            @Html.RenderControl(MapControlType.NavigationControl, MapAnchorEnum.BMAP_ANCHOR_TOP_LEFT)
        }
        @*
    <script>
        $(function () {
            window.Map_map1 = new BMap.Map('map1');
            window.Map_map1.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
        });
    </script>
    @Html.BaiduMap("map1", 104.097334, 30.556514, 13, new[]
    {
        new MapControl
        {
            ControlType = MapControlType.ScaleControl,
            Option = new MapControlOption
            {
                X = 30,
                Y = 10,
                Anchor = MapAnchorEnum.BMAP_ANCHOR_TOP_LEFT
            }
        },
        new MapControl
        {
            ControlType = MapControlType.GeolocationControl,
            Option = new MapControlOption
            {
                X = 10,
                Y = 10,
                Anchor = MapAnchorEnum.BMAP_ANCHOR_TOP_RIGHT
            }
        }
    })*@
        <div id="map2" style="width: 100%; height: 500px"></div>
        @*
        @using (Html.BeginBaiduMap("map2", 104.073025, 30.550597, 12))
        {
            @Html.RenderMarker(new MapMarker
            {
                Latitude = 104.074597,
                Longitude = 30.550458,
                Draggable = true,
                OnClientClick = "alertMe"
            })
            @Html.RenderControls(new MapControl
            {
                ControlType = MapControlType.MapTypeControl,
                Option = new MapControlOption
                {
                    Anchor = MapAnchorEnum.BMAP_ANCHOR_TOP_LEFT,
                    X = 5,
                    Y = 5
                }
            })
        }
        *@
        <hr/>
    </div>
</body>
</html>